home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / NewsTicker.sit / NewsTicker / source code / Extractors / HTMLExtractor.h < prev    next >
Text File  |  1997-06-26  |  2KB  |  87 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    NewsTicker, my Hack for 1997
  4. #
  5. #    HTMLExtractor.h    -    Base class to read an HTML page in, and parse
  6. #                            out the interesting stuff.  Useless on its own,
  7. #                            only exists to be derived..
  8. #
  9. ------------------------------------------------------------------------------*/
  10. #ifndef HTMLEXTRACTOR_H
  11. #define HTMLEXTRACTOR_H
  12.  
  13. // We can only use SubWoofer under PowerPC
  14. #ifdef powerc
  15. // Disable this to use our own OT code
  16. #define USESUBWOOFER
  17. #endif
  18.  
  19. //+++Inc - Includes for files not directly related to this project
  20. #include <OpenTransport.h>
  21. #include <OpenTptInternet.h>
  22. #include <Types.h>
  23. #include "TickerGlobals.h"
  24.  
  25. //These actually read the stuff in
  26. class SubWooferEndPoint;
  27. class HTTPEndPoint;
  28.  
  29. // read a whole HTML file in, and parse it
  30.  
  31. #define tempmaxHeadlines 50
  32.  
  33. class HTMLExtractor
  34. {
  35.     protected:
  36.  
  37. #ifdef USESUBWOOFER
  38.         SubWooferEndPoint* mfWebPipe;
  39. #else
  40.         HTTPEndPoint* mfHTTPPipe;
  41. #endif
  42.         Boolean    mfDoingARead;
  43.         Boolean    mfReadingHeader;
  44.         char    mfAddress[32];
  45.         short    mfIconID;
  46.         char    thetext[2048];
  47.         short    thetextsize;
  48.         char    thetag[2048];
  49.         short    thetagsize;
  50.         Str31    mfLastModified;
  51.         Boolean    AmOnTag;
  52.         Boolean    temp;
  53.         sMyDataPtr    mfTheDataPtr;
  54.         
  55.         sHeadline    mfTempHeadlines[tempmaxHeadlines];
  56.         short        mfTempHeadlineCount;
  57.  
  58.      
  59.     public:
  60.                         HTMLExtractor        (char* theaddress, short theIconID, sMyDataPtr theDataPtr);
  61.         virtual        ~HTMLExtractor        (void);
  62.         
  63.         // Called by base app to read all entries in, or check header and see if it's changed
  64.         void            ReadLastModified(void);
  65.         void            GetLastModified    (Str31 LastModStr);
  66.         // Called by base app to read all entries in
  67.         void            ReadEntries        (void);
  68.         
  69.         // Called by endpoint as it gets strings
  70.         void            ReceiveString    (char* string, short numchars);
  71.         
  72.         virtual void    HandleToken(char* string, short numchars, Boolean isCommand);
  73.         void             AddEntry(Str255 theSubject, Str255 theURL);
  74.         Boolean            ParseGoodURL(char* thestring, Str255 theURL);
  75.         
  76.         virtual void    Disconnect(void);
  77.         
  78.         void            Cancel(void);
  79.     
  80. };
  81.  
  82. Boolean    MyCompareStr(char* p1, char* p2);
  83. void FindATag(char* tag, char* theLink, char* theMarker);
  84.  
  85.  
  86. #endif        //HTMLEXTRACTOR_H
  87.